'use client' import { Button } from '@/components/ui/button' import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from '@/components/ui/dialog' import { Drawer, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle, } from '@/components/ui/drawer' import { Label } from '@/components/ui/label' import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group' import { getGroup } from '@/lib/api' import { useMediaQuery } from '@/lib/hooks' import { cn } from '@/lib/utils' import { ComponentProps, useEffect, useState } from 'react' type Props = { group: NonNullable>> } export function ActiveUserModal({ group }: Props) { const [open, setOpen] = useState(false) const isDesktop = useMediaQuery('(min-width: 768px)') useEffect(() => { const tempUser = localStorage.getItem(`newGroup-activeUser`) const activeUser = localStorage.getItem(`${group.id}-activeUser`) if (!tempUser && !activeUser) { setOpen(true) } }, [group]) function updateOpen(open: boolean) { if (!open && !localStorage.getItem(`${group.id}-activeUser`)) { localStorage.setItem(`${group.id}-activeUser`, 'None') } setOpen(open) } if (isDesktop) { return ( Who are you? Tell us which participant you are to let us customize how the information is displayed. setOpen(false)} />

This setting can be changed later in the group settings.

) } return ( Who are you? Tell us which participant you are to let us customize how the information is displayed. setOpen(false)} />

This setting can be changed later in the group settings.

) } function ActiveUserForm({ group, close, className, }: ComponentProps<'form'> & { group: Props['group']; close: () => void }) { const [selected, setSelected] = useState('None') return (
{ event.preventDefault() localStorage.setItem(`${group.id}-activeUser`, selected) close() }} >
{group.participants.map((participant) => (
))}
) }